package edu.sctu.zhangwang.month201506.day20150615;

import java.io.*;

/**
 * Created by user10 on 2015/6/15.
 */
public class MyName {
    public void repid(){
        InputStream in = System.in;
        System.out.println("请输入你的内容：");
        byte[] bytes = new byte[1024];
        int len = 0;
        try {
            len = in.read(bytes);
            System.out.println("你输入的内容是："+new String(bytes,0,len));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public void input(){
        int a = 0;
        int count = 0;
        File file = new File("D://wo.txt");
        byte[] bytes = new byte[1024];
        try {
            FileInputStream f = new FileInputStream(file);
            try {
                a = f.read(bytes);
                System.out.println(a);
               String w =  new String(bytes,0,a);
                System.out.println("文件里的内容是："+w);
            f.close();
            } catch (IOException e) {
                e.printStackTrace();
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
    public void shuRu(){
        InputStream i = System.in;
        System.out.println("请输入你的生日：");
//        System.out.println("你的生日是："+i);
    }


    public static void main(String[] args) {
        MyName myName = new MyName();
        myName.repid();
        myName.input();
//        myName.shuRu();
    }

}
